class Model
{
protected:
	class SphereData
	{
		public:
			SphereData()
			{
				ForX = 0;
				ForY = 0;
			}
		float PosX,PosY,Radius,ForX,ForY;
	};

	class RectData
	{
	public:
		RectData()
		{
			FRX = 0;
			FRY = 0;
			FLX = 0;
			FLY = 0;
		}
		float RPosX,RPosY, LPosX, LPosY, width;
		float FRX, FRY, FLX, FLY;
		float Length()
		{
			return sqrt((RPosX - LPosX)*(RPosX - LPosX) + (RPosY - LPosY)*(RPosY - LPosY));
		}
	};

	void SplitUp();
	void Grow();
	void PlusForce();
	void Move();
	void InsertNew();
	void Swap();

public:
	Model()
	{
		srand ( time(NULL) );
		KConst = 1;
		SwapRight = 1000;
		SwapLeft  = 0   ;
		Floor     = 0   ;
		EachOverLap = false;
	}
	int KConst, SwapRight, SwapLeft, Floor;
	bool EachOverLap ;
	float GrowFunction(float, float, float);
};

float Model::GrowFunction(float ic, float dt, float r_division)
{
    float k1=growth_rate*ic*( 1-ic/r_division );
    float k2=growth_rate*( ic + (dt/2)*k1 )*( 1-( ic + (dt/2)*k1 )/r_division );
    float k3=growth_rate*( ic + (dt/2)*k2 )*( 1-( ic + (dt/2)*k2 )/r_division);
    float k4=growth_rate*( ic + dt*k3 )*(1-( ic + dt*k3 )/r_division);
    
    return (dt/6)*(k1+2*k2+2*k3+k4);
}